package com.haochen.ouser.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @Author: zhangquancheng
 * @Description:
 */
@RestController
public class TestController {
    private String serviceName = "order-service";

    @Autowired
    RestTemplate restTemplate;

    @RequestMapping(method = RequestMethod.GET,path = "/getUser")
    public String getUser(){
        String order = restTemplate.getForObject("http://"+serviceName+"/getOrder", String.class);
        return "我是张三,订单号为：" + order;
    }

}
